package robot.arm;

import com.sun.j3d.utils.geometry.*;

import com.sun.j3d.utils.universe.*;

import javax.media.j3d.*;

import javax.vecmath.*;

public abstract class Joint {

	protected String name;
	protected int dof;
	protected float smallestAngle; // minimum range of movement
	protected float widestAngle;  // maximum range of movement
	protected float currentAngle;
	protected int jointType;
	protected Vector3f currentPosition;
	protected Sphere jointShape;
	protected Link attachedLink;  // This will be the link that actually gets moved
	protected String attachedLinkName;
	
	public static int VERTICAL_MOVEMENT = 0;
	public static int HORIZONTAL_MOVEMENT = 1;
	public static int ROTATIONAL = 2;
	public static int BALL_AND_SOCKET = 3;
	
	public Joint (int newType, Vector3f initialSpot) {
		jointType = newType;
		currentPosition = initialSpot;
		
		// make the Sphere
		jointShape = new Sphere(1.0f);
		jointType = newType;
	}
	
	public Joint(int newType) {
		
		jointType = newType;
		jointShape = new Sphere(1.0f);
		
		//currentPosition = new Vector3f(0f, 0f, 0f);
		
	}
	
	public Joint () {
		jointType = 3;
		jointShape = new Sphere(1.0f);
		//currentPosition = new Vector3f(0f, 0f, 0f);
	}
	
	public Sphere getShape() {
		return jointShape;
	}
	
	public abstract void moveLink(Vector3f direction);
	
	public abstract void moveLink();
	
	public abstract void setMinimumAngle();
	public abstract void setMaximumAngle();

	public abstract float getMinimumAngle();
	public abstract float getMaximumAngle();
	
	public abstract Vector3f getPosition();
	
}